package com.tanker.config;

import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

import com.tanker.base.filter.MyFilter;

/**
 * @author xqxue
 * @time 2018年7月31日 下午5:25:32
 */
public class FilterCofig {

	@Bean
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public FilterRegistrationBean someFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(myFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("myFilter");
        return registration;
    }

    @Bean(name = "myFilter")
    public Filter myFilter() {
        return new MyFilter();
    }
}
